#ifndef HTML_GLOBALS_H_INCLUDED
#define HTML_GLOBALS_H_INCLUDED

#include <string>
#include <vector>
#include <cctype>

using namespace std;

/// ---- macro magic :)

// just add tags here, the macro will do the rest
// --- note decided to save end tags as these can be used to help rendering

#define TAG_HASHES \
    N(a) \
    N(abbr) \
    N(acronym) \
    N(address) \
    N(applet) \
    N(area) \
    N(b) \
    N(base) \
    N(basefont) \
    N(bdo) \
    N(big) \
    N(blockquote) \
    N(body) \
    N(br) \
    N(button) \
    N(caption) \
    N(center) \
    N(cite) \
    N(code) \
    N(col) \
    N(colgroup) \
    N(dd) \
    N(del) \
    N(dir) \
    N(div) \
    N(dfn) \
    N(dl) \
    N(dt) \
    N(em) \
    N(fieldset) \
    N(font) \
    N(form) \
    N(frame) \
    N(frameset) \
    N(h1) \
    N(h2) \
    N(h3) \
    N(h4) \
    N(h5) \
    N(h6) \
    N(head) \
    N(hr) \
    N(html) \
    N(i) \
    N(iframe) \
    N(img) \
    N(input) \
    N(ins) \
    N(isindex) \
    N(kbd) \
    N(label) \
    N(legend) \
    N(li) \
    N(link) \
    N(map) \
    N(menu) \
    N(meta) \
    N(noframes) \
    N(noscript) \
    N(object) \
    N(ol) \
    N(optgroup) \
    N(option) \
    N(p) \
    N(param) \
    N(pre) \
    N(q) \
    N(s) \
    N(samp) \
    N(script) \
    N(select) \
    N(small) \
    N(span) \
    N(strike) \
    N(strong) \
    N(style) \
    N(sub) \
    N(sup) \
    N(table) \
    N(tbody) \
    N(td) \
    N(textarea) \
    N(tfoot) \
    N(th) \
    N(thead) \
    N(title) \
    N(tr) \
    N(tt) \
    N(u) \
    N(ul) \
    N(var) \
    N(xmp) \
    \
    N(_comment) \
    N(_text) \
    \
    N(_a) \
    N(_abbr) \
    N(_acronym) \
    N(_address) \
    N(_applet) \
    N(_area) \
    N(_b) \
    N(_base) \
    N(_basefont) \
    N(_bdo) \
    N(_big) \
    N(_blockquote) \
    N(_body) \
    N(_br) \
    N(_button) \
    N(_caption) \
    N(_center) \
    N(_cite) \
    N(_code) \
    N(_col) \
    N(_colgroup) \
    N(_dd) \
    N(_del) \
    N(_dir) \
    N(_div) \
    N(_dfn) \
    N(_dl) \
    N(_dt) \
    N(_em) \
    N(_fieldset) \
    N(_font) \
    N(_form) \
    N(_frame) \
    N(_frameset) \
    N(_h1) \
    N(_h2) \
    N(_h3) \
    N(_h4) \
    N(_h5) \
    N(_h6) \
    N(_head) \
    N(_hr) \
    N(_html) \
    N(_i) \
    N(_iframe) \
    N(_img) \
    N(_input) \
    N(_ins) \
    N(_isindex) \
    N(_kbd) \
    N(_label) \
    N(_legend) \
    N(_li) \
    N(_link) \
    N(_map) \
    N(_menu) \
    N(_meta) \
    N(_noframes) \
    N(_noscript) \
    N(_object) \
    N(_ol) \
    N(_optgroup) \
    N(_option) \
    N(_p) \
    N(_param) \
    N(_pre) \
    N(_q) \
    N(_s) \
    N(_samp) \
    N(_script) \
    N(_select) \
    N(_small) \
    N(_span) \
    N(_strike) \
    N(_strong) \
    N(_style) \
    N(_sub) \
    N(_sup) \
    N(_table) \
    N(_tbody) \
    N(_td) \
    N(_textarea) \
    N(_tfoot) \
    N(_th) \
    N(_thead) \
    N(_title) \
    N(_tr) \
    N(_tt) \
    N(_u) \
    N(_ul) \
    N(_var) \
    N(_xmp)


#define ATTRIB_HASHES \
    N(color) \
    N(bgcolor) \
    N(class) \
    N(id) \
    N(href) \
    N(src) \
    N(width) \
    N(height) \
    N(background) \
    N(text) \
    N(alink) \


static unsigned long create_hash(const char* x) {
    unsigned long hash = 0;

    const char* ptr = x;
    while (*ptr) hash = (hash << 5) + hash + *ptr++;

    return hash;
};

#define N(n) const unsigned long hash_##n = create_hash(#n);
TAG_HASHES
#undef N

#define N(n) const unsigned long a_hash_##n = create_hash(#n);
ATTRIB_HASHES
#undef N

/// ---- eof macro magic

#endif // HTML_GLOBALS_H_INCLUDED
